﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Se.Framework.Common.Extentions
{
    public static class ListExtentions
    {
        public static ICollection<T> AddItem<T>(this ICollection<T> list, T item)
        {
            list.Add(item);
            return list;
        }

        public static ICollection<T> AddItemsRange<T>(this ICollection<T> list, params T[] items)
        {
            foreach (var item in items)
            {
                list.AddItem(item);
            }
            return list;
        }

        public static ICollection<T> AddItemsRange<T>(this ICollection<T> list, IEnumerable<T> items)
        {
            foreach (var item in items)
            {
                list.AddItem(item);
            }
            return list;
        }

        public static List<T> AddItem<T>(this List<T> list, T item)
        {
            list.Add(item);
            return list;
        }

        public static List<T> AddItemsRange<T>(this List<T> list, params T[] items)
        {
            list.AddRange(items);
            return list;
        }

        public static List<T> AddItemsRange<T>(this List<T> list, IEnumerable<T> items)
        {
            list.AddRange(items);
            return list;
        }
    }
}